<template>
  <div>

    <el-menu :default-active="activeIndex" class="el-menu-demo" mode="horizontal" @select="handleSelect">
      <el-menu-item index="1">作业管理</el-menu-item>
      <el-menu-item index="4"><a href="https://www.ele.me" target="_blank">文件管理</a></el-menu-item>
    </el-menu>
    <div class="line"></div>


    <el-card style="padding: 10px">

      <el-form :model="queryParams">
        <el-input
          style="width: 240px"
          v-model="queryParams.teacherId"
          placeholder="请输入教师id"
        />
        <el-button @click="A">查询</el-button>

      </el-form>


      <el-table
        ref="multipleTable"
        :data="tableData"
        tooltip-effect="dark"
        style="width: 100%"
        @selection-change="handleSelectionChange">
        <el-table-column label="id" align="center" prop="id" />
        <el-table-column label="作业名" align="center" prop="title" />
        <el-table-column label="操作">
          <template slot-scope="scope">
            <el-button type="primary" size="mini" @click="QuestionDetail(scope.row)">查看</el-button>
          </template>
        </el-table-column>
      </el-table>
    </el-card>

  </div>

</template>

<script>

  import { queryQuestionList,queryProblemByTopicId} from "@/api/teacher/detail/course/detail";

  export default {

    name: "detail",

    created() {
      this.getUser();
    },
    data(){
      return {
        activeIndex: '1',
        activeIndex2: '1',
        queryParams: {
          pageNum: 1,
          pageSize: 10,
          teacherId: null,
        },
        user: {},
        tableData: []
      }
    },
    methods: {
      handleSelect(key, keyPath) {
        console.log(key, keyPath);
      },
      QuestionDetail(row){
        console.log(row)

      },
      // getUser() {
      //    this.id = this.$route.query.id
      //    console.log(this.id)
      //     queryQuestionList(this.id).then(response =>{
      //       this.tableData  = response.problems
      //     });
      // },
      getUser() {
        this.id = this.$route.query.id
        console.log(this.id)
        queryProblemByTopicId(this.id).then(response =>{
          console.log(response)
          this.tableData  = response
        });
      },
      A(){
        getListT(this.queryParams.teacherId).then(response =>{
          this.tableData  = response
        })
      }
    }
  }
</script>

<style scoped>

</style>
